package com.oa.xinxi.dao;

import com.oa.xinxi.entity.MSGManager;
import org.apache.ibatis.jdbc.SQL;

public class MSGManagerSqlProvider {

    public String insertSelective(MSGManager record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("xx_gl");
        
        if (record.getXxglId() != null) {
            sql.VALUES("xxgl_id", "#{xxglId,jdbcType=INTEGER}");
        }
        
        if (record.getSendUserId() != null) {
            sql.VALUES("send_user_id", "#{sendUserId,jdbcType=INTEGER}");
        }
        
        if (record.getReceiveUserId() != null) {
            sql.VALUES("receive_user_id", "#{receiveUserId,jdbcType=INTEGER}");
        }
        
        if (record.getTitle() != null) {
            sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
        }
        
        if (record.getType() != null) {
            sql.VALUES("type", "#{type,jdbcType=VARCHAR}");
        }
        
        if (record.getReadOrNot() != null) {
            sql.VALUES("read_or_not", "#{readOrNot,jdbcType=VARCHAR}");
        }
        
        if (record.getOpenOrNot() != null) {
            sql.VALUES("open_or_not", "#{openOrNot,jdbcType=VARCHAR}");
        }
        
        if (record.getJsTime() != null) {
            sql.VALUES("js_time", "#{jsTime,jdbcType=VARCHAR}");
        }
        
        if (record.getFsTime() != null) {
            sql.VALUES("fs_time", "#{fsTime,jdbcType=VARCHAR}");
        }
        
        if (record.getContent() != null) {
            sql.VALUES("content", "#{content,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(MSGManager record) {
        SQL sql = new SQL();
        sql.UPDATE("xx_gl");
        
        if (record.getSendUserId() != null) {
            sql.SET("send_user_id = #{sendUserId,jdbcType=INTEGER}");
        }
        
        if (record.getReceiveUserId() != null) {
            sql.SET("receive_user_id = #{receiveUserId,jdbcType=INTEGER}");
        }
        
        if (record.getTitle() != null) {
            sql.SET("title = #{title,jdbcType=VARCHAR}");
        }
        
        if (record.getType() != null) {
            sql.SET("type = #{type,jdbcType=VARCHAR}");
        }
        
        if (record.getReadOrNot() != null) {
            sql.SET("read_or_not = #{readOrNot,jdbcType=VARCHAR}");
        }
        
        if (record.getOpenOrNot() != null) {
            sql.SET("open_or_not = #{openOrNot,jdbcType=VARCHAR}");
        }
        
        if (record.getJsTime() != null) {
            sql.SET("js_time = #{jsTime,jdbcType=VARCHAR}");
        }
        
        if (record.getFsTime() != null) {
            sql.SET("fs_time = #{fsTime,jdbcType=VARCHAR}");
        }
        
        if (record.getContent() != null) {
            sql.SET("content = #{content,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("xxgl_id = #{xxglId,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}